/*
package com.rinlink.gateway.jt808.configuration;

import com.rinlink.gateway.jt808.jt808.MessageToKafka;
import io.github.hylexus.jt808.boot.config.DefaultJt808ServerAutoConfigure;
import io.github.hylexus.jt808.dispatcher.RequestMsgDispatcher;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.config.KafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.KafkaTemplate;

@Configuration
@EnableConfigurationProperties(Jt808GatewayKafkaProperties.class)
@ConditionalOnProperty(matchIfMissing = true,prefix = "jt808.gateway.provide",name = "kafka")
@AutoConfigureBefore(DefaultJt808ServerAutoConfigure.class)
public class Jt808GatewayKafkaConfiguration {

    public final Jt808GatewayKafkaProperties jt808GatewayProperties;

    public Jt808GatewayKafkaConfiguration(Jt808GatewayKafkaProperties properties){
        this.jt808GatewayProperties = properties;
    }

    @Bean
    public RequestMsgDispatcher jt808RequestMsgDispatcher(KafkaTemplate kafkaTemplate){
        return new MessageToKafka(kafkaTemplate,jt808GatewayProperties.getRequest().getTopic());
    }


    @Bean
    public KafkaListenerContainerFactory jt808KafkaMessageListenerFactory(
            ConsumerFactory consumerFactory
    ){
        ConcurrentKafkaListenerContainerFactory containerFactory =
                new ConcurrentKafkaListenerContainerFactory<>();
        containerFactory.setConsumerFactory(consumerFactory);
        return containerFactory;
    }



*/
/*    @Bean
    public MessageListenerContainer jt808MessageListener(Jt808KafkaRequestMessageListener listener
            , ConsumerFactory consumerFactory){

        ContainerProperties properties = new ContainerProperties(jt808GatewayProperties.getRequest().getTopic());
        properties.setMessageListener(listener);
     //   MessageListenerContainer container = new KafkaMessageListenerContainer<String,String>(consumerFactory,properties);

        properties.setAckMode(ContainerProperties.AckMode.RECORD);
        ConcurrentMessageListenerContainer container = new ConcurrentMessageListenerContainer(consumerFactory,properties);
        container.setConcurrency(jt808GatewayProperties.getRequest().getProcessor().getConcurrency());
        container.start();
     //   container.getAssignedPartitions();
        return container;
    }*//*



}
*/
